function IR = cartesianas2(I)
 [M N] = size(I);
 IR = zeros(M,N);
 Om = (M+1)/2;                  % co-ordinates of the center of the image
 On = (N+1)/2;
 R=0.18;
 a=2^(1/25);
 rmin=(a^(-M/2))*R;
 rmax=(a^(M/2))*R;
 
 
 
for xi = 1:M
  for yi = 1:N
     x = (xi - Om);
     y = (yi - On);
     r= sqrt(x^2 + y^2);
     theta = atan2(y,x);
     %[theta,r]=cart2pol(x,y);
     %theta=(180*theta1)/pi;
    
 
     if (r >=rmin) && (r <=rmax)
        %theta = atan2(y,x);
        %if theta < 0
        %    theta = theta + 2*pi;
        %end 
       
        l1 =abs(floor((log(r/R)/(log(a)))+M/2));
        l2 =abs(floor((N*theta)/pi));
          
        if(l1>=1 && l1<=M) && (l2>=1 && l2<=N)
           IR (xi, yi) = I(l1,l2);
           %IR (l1,l2) =1;
        end
      end 
  end
end
end